\(\int \frac {\cos (c+d x) (B \sec (c+d x)+C \sec ^2(c+d x))}{a+a \sec (c+d x)} \, dx\) [336]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [B] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 38, antiderivative size = 35 \[ \int \frac {\cos (c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+a \sec (c+d x)} \, dx=\frac {B x}{a}-\frac {(B-C) \tan (c+d x)}{d (a+a \sec (c+d x))} \]

[Out]

B*x/a-(B-C)*tan(d*x+c)/d/(a+a*sec(d*x+c))

Rubi [A] (verified)

Time = 0.16 (sec) , antiderivative size = 35, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.079, Rules used = {4157, 4004, 3879} \[ \int \frac {\cos (c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+a \sec (c+d x)} \, dx=\frac {B x}{a}-\frac {(B-C) \tan (c+d x)}{d (a \sec (c+d x)+a)} \]

[In]

Int[(Cos[c + d*x]*(B*Sec[c + d*x] + C*Sec[c + d*x]^2))/(a + a*Sec[c + d*x]),x]

[Out]

(B*x)/a - ((B - C)*Tan[c + d*x])/(d*(a + a*Sec[c + d*x]))

Rule 3879

Int[csc[(e_.) + (f_.)*(x_)]/(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)), x_Symbol] :> Simp[-Cot[e + f*x]/(f*(b + a*
Csc[e + f*x])), x] /; FreeQ[{a, b, e, f}, x] && EqQ[a^2 - b^2, 0]

Rule 4004

Int[(csc[(e_.) + (f_.)*(x_)]*(d_.) + (c_))/(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)), x_Symbol] :> Simp[c*(x/a),
x] - Dist[(b*c - a*d)/a, Int[Csc[e + f*x]/(a + b*Csc[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[
b*c - a*d, 0]

Rule 4157

Int[((a_.) + csc[(e_.) + (f_.)*(x_)]*(b_.))^(m_.)*((A_.) + csc[(e_.) + (f_.)*(x_)]*(B_.) + csc[(e_.) + (f_.)*(
x_)]^2*(C_.))*((c_.) + csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_.), x_Symbol] :> Dist[1/b^2, Int[(a + b*Csc[e + f*x])
^(m + 1)*(c + d*Csc[e + f*x])^n*(b*B - a*C + b*C*Csc[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f, A, B, C, m,
 n}, x] && EqQ[A*b^2 - a*b*B + a^2*C, 0]

Rubi steps \begin{align*} \text {integral}& = \int \frac {B+C \sec (c+d x)}{a+a \sec (c+d x)} \, dx \\ & = \frac {B x}{a}-(B-C) \int \frac {\sec (c+d x)}{a+a \sec (c+d x)} \, dx \\ & = \frac {B x}{a}-\frac {(B-C) \tan (c+d x)}{d (a+a \sec (c+d x))} \\ \end{align*}

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(76\) vs. \(2(35)=70\).

Time = 0.33 (sec) , antiderivative size = 76, normalized size of antiderivative = 2.17 \[ \int \frac {\cos (c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+a \sec (c+d x)} \, dx=-\frac {\sin (c+d x) \left (B \arcsin (\cos (c+d x)) (1+\cos (c+d x))+(B-C) \sqrt {\sin ^2(c+d x)}\right )}{a d \sqrt {1-\cos (c+d x)} (1+\cos (c+d x))^{3/2}} \]

[In]

Integrate[(Cos[c + d*x]*(B*Sec[c + d*x] + C*Sec[c + d*x]^2))/(a + a*Sec[c + d*x]),x]

[Out]

-((Sin[c + d*x]*(B*ArcSin[Cos[c + d*x]]*(1 + Cos[c + d*x]) + (B - C)*Sqrt[Sin[c + d*x]^2]))/(a*d*Sqrt[1 - Cos[
c + d*x]]*(1 + Cos[c + d*x])^(3/2)))

Maple [A] (verified)

Time = 0.14 (sec) , antiderivative size = 28, normalized size of antiderivative = 0.80

method result size
parallelrisch \(\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (-B +C \right )+B x d}{d a}\) \(28\)
derivativedivides \(\frac {-\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) B +\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) C +2 B \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d a}\) \(45\)
default \(\frac {-\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) B +\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) C +2 B \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d a}\) \(45\)
risch \(\frac {B x}{a}-\frac {2 i B}{d a \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}+\frac {2 i C}{d a \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}\) \(54\)
norman \(\frac {\frac {B x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}}{a}+\frac {\left (B -C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{a d}-\frac {B x}{a}-\frac {\left (B -C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5}}{a d}}{\left (1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right ) \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1\right )}\) \(102\)

[In]

int(cos(d*x+c)*(B*sec(d*x+c)+C*sec(d*x+c)^2)/(a+a*sec(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

(tan(1/2*d*x+1/2*c)*(-B+C)+B*x*d)/d/a

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 44, normalized size of antiderivative = 1.26 \[ \int \frac {\cos (c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+a \sec (c+d x)} \, dx=\frac {B d x \cos \left (d x + c\right ) + B d x - {\left (B - C\right )} \sin \left (d x + c\right )}{a d \cos \left (d x + c\right ) + a d} \]

[In]

integrate(cos(d*x+c)*(B*sec(d*x+c)+C*sec(d*x+c)^2)/(a+a*sec(d*x+c)),x, algorithm="fricas")

[Out]

(B*d*x*cos(d*x + c) + B*d*x - (B - C)*sin(d*x + c))/(a*d*cos(d*x + c) + a*d)

Sympy [F]

\[ \int \frac {\cos (c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+a \sec (c+d x)} \, dx=\frac {\int \frac {B \cos {\left (c + d x \right )} \sec {\left (c + d x \right )}}{\sec {\left (c + d x \right )} + 1}\, dx + \int \frac {C \cos {\left (c + d x \right )} \sec ^{2}{\left (c + d x \right )}}{\sec {\left (c + d x \right )} + 1}\, dx}{a} \]

[In]

integrate(cos(d*x+c)*(B*sec(d*x+c)+C*sec(d*x+c)**2)/(a+a*sec(d*x+c)),x)

[Out]

(Integral(B*cos(c + d*x)*sec(c + d*x)/(sec(c + d*x) + 1), x) + Integral(C*cos(c + d*x)*sec(c + d*x)**2/(sec(c
+ d*x) + 1), x))/a

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 73 vs. \(2 (35) = 70\).

Time = 0.34 (sec) , antiderivative size = 73, normalized size of antiderivative = 2.09 \[ \int \frac {\cos (c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+a \sec (c+d x)} \, dx=\frac {B {\left (\frac {2 \, \arctan \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1}\right )}{a} - \frac {\sin \left (d x + c\right )}{a {\left (\cos \left (d x + c\right ) + 1\right )}}\right )} + \frac {C \sin \left (d x + c\right )}{a {\left (\cos \left (d x + c\right ) + 1\right )}}}{d} \]

[In]

integrate(cos(d*x+c)*(B*sec(d*x+c)+C*sec(d*x+c)^2)/(a+a*sec(d*x+c)),x, algorithm="maxima")

[Out]

(B*(2*arctan(sin(d*x + c)/(cos(d*x + c) + 1))/a - sin(d*x + c)/(a*(cos(d*x + c) + 1))) + C*sin(d*x + c)/(a*(co
s(d*x + c) + 1)))/d

Giac [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 44, normalized size of antiderivative = 1.26 \[ \int \frac {\cos (c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+a \sec (c+d x)} \, dx=\frac {\frac {{\left (d x + c\right )} B}{a} - \frac {B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - C \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{a}}{d} \]

[In]

integrate(cos(d*x+c)*(B*sec(d*x+c)+C*sec(d*x+c)^2)/(a+a*sec(d*x+c)),x, algorithm="giac")

[Out]

((d*x + c)*B/a - (B*tan(1/2*d*x + 1/2*c) - C*tan(1/2*d*x + 1/2*c))/a)/d

Mupad [B] (verification not implemented)

Time = 16.01 (sec) , antiderivative size = 32, normalized size of antiderivative = 0.91 \[ \int \frac {\cos (c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+a \sec (c+d x)} \, dx=-\frac {\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (B-C\right )}{a}-\frac {B\,d\,x}{a}}{d} \]

[In]

int((cos(c + d*x)*(B/cos(c + d*x) + C/cos(c + d*x)^2))/(a + a/cos(c + d*x)),x)

[Out]

-((tan(c/2 + (d*x)/2)*(B - C))/a - (B*d*x)/a)/d